package cn.wolfcode.MyEnum;

import lombok.Getter;

@Getter
public enum ConsumptionEnum {
    CONSUME("待结算", 0),
    AUDIT("待审核", 1),
    FINISH("归档", 2),
    FAILURE("坏账", 3);

    private String name;
    private Integer value;

    ConsumptionEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    //提供一个根据value 获取名字的方法
    public static String findName(Integer value) {
        ConsumptionEnum[] values = ConsumptionEnum.values();
        for (ConsumptionEnum a :
                values) {
            if (a.getValue().equals(value)) {
                return a.getName();
            }
        }
        return null;
    }
}
